package vista;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import modelo.dao.DAO;
import modelo.transfer.Socio;
import modelo.transfer.Usuario;
import controlador.Controlador;

public class FrameModSocUsu extends JFrame {

	private JPanel contentPane;
	private JPanel padre;

	/**
	 * Launch the application.
	 */
	public static void main(final boolean tipo, final Object id, final DAO d, final Controlador c, final JPanel padre) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					FrameModSocUsu frame = new FrameModSocUsu(tipo, id, d, c, padre);
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public FrameModSocUsu(boolean tipo, Object id, DAO d, Controlador c, JPanel dad) {
			setResizable(false);
			setAlwaysOnTop(true);
			this.padre = dad;
			setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
			setBounds(100, 100, 450, 300);
			if (tipo){
				contentPane = new PanelModSocio(d, c, (Socio) id);
				contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
				contentPane.setLayout(new BorderLayout(0, 0));
				setContentPane(contentPane);
			}else{
				contentPane = new PanelModUsuario(d, c, (Usuario) id);
				contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
				contentPane.setLayout(new BorderLayout(0, 0));
				setContentPane(contentPane);
			}
	}
	
	public JPanel getPadre(){
		return this.padre;
	}

}
